/*
package com.bicon.botu.mall.goods.processor.mq;

import com.bicon.botu.account.entity.Resources;
import com.bicon.botu.account.service.ResourcesService;
import com.bicon.botu.core.base.bean.SelfResources;
import com.bicon.botu.core.base.common.EventConstants;
import com.bicon.botu.core.base.common.entity.BaseMQEntity;
import lombok.extern.log4j.Log4j;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

*/
/**
 * @author miou
 * Created by fyx on 2017/3/9 0009.
 *//*

@Component
@Log4j
public class ListenerRouter {

    @Autowired
    ResourcesService resourcesService;

    @RabbitListener(queues ={"account"})
    @RabbitHandler()
    public void process(BaseMQEntity entity) {
        log.info(entity.getEvent());
        if (entity.getEvent().equals(EventConstants.Event_Registory_Resources)){
            //资源更新事件
            SelfResources selfResources = (SelfResources)entity.getT();
            List<Resources> list = new ArrayList<>();
            for (String s:selfResources.getMap().keySet()){
                Resources resources = new Resources();
                resources.setPath(s);
                resources.setSupporMethod(selfResources.getMap().get(s));
                resources.preInsert();
                list.add(resources);
            }
            resourcesService.save(list);
        }
    }
}
*/
